#!/bin/bash

if [ $0 != "./dist-clean.sh" ]; then
    echo "Only ./dist-clean.sh:"
    echo "  ./PATH/TO/dist-clean.sh or dist-clean.sh won't work"
else
    make clean 2>/dev/null
    rm CMakeCache.txt 2>/dev/null
    for todl in `find -name "*~"`; do
        rm ${todl} 2>/dev/null
    done
    for todl in `find -name "CMakeFiles"`; do
        rm -rf ${todl} 2>/dev/null
    done
    for todl in `find -name "Makefile"`; do
        rm ${todl} 2>/dev/null
    done
    for todl in `find -name "cmake_install.cmake"`; do
        rm ${todl} 2>/dev/null
    done
    rm -rf "doc/html" 2>/dev/null
fi
